package com.event;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * @Description: 定义测试事件监听
 * @Author: LiHaiChao
 * @Date: 2022/1/11 17:16:24
 * @Version: 1.0
 */
@Slf4j
@Component
public class DemoEventListener {

    @Async
    @EventListener(DemoEvent.class)
    public void handler(DemoEvent event){
        System.out.println("Event 事件监听处理...");
        Object source = event.getSource();
        System.out.println("参数-> " + source.toString());
    }
}
